<?php
/**
*
*	后台函数库 @zairwolf
*/
if(!defined('IN_ACP')) exit('Access Denied');

function acpheader(){
	if(defined('ACPHEADER_SENDED')) {
		return;
	}else {
		define('ACPHEADER_SENDED', true);
	}
	$tpl = new Tpl('header');
	$tpl->output();
}

function acpfooter(){
	if(defined('ACPFOOTER_SENDED')) {
		return;
	}else {
		define('ACPFOOTER_SENDED', true);
	}
	$tpl = new Tpl('footer');
	$tpl->output();
	exit();
}

//后台权限检测 ok
function acppriv(){
	$args = func_get_args();

	if(!$args) {
		return $GLOBALS['isfounder'];
	}else {
		return $GLOBALS['isfounder'] || in_array(implode('_', $args), $GLOBALS['adminpriv']);
	}
}

//2009-4-22 10:03改名
function clearCache($prefix = ''){
	if(!$prefix) {
		rrmdir(ROOT.'data/cache', true);
	}elseif(in_array($prefix,array('template','api'))) {
		rrmdir(ROOT.'data/cache/'.$prefix, true);
	}else {
		$fs = rlistfile(ROOT.'data/cache');
		$pl = strlen($prefix);
		foreach($fs as $f)
			if(substr($f, 0, $pl) == $prefix)
				unlink(ROOT.'data/cache/'.$f);
	}
}

